package cn.mastor.domain;

import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author whale
 * @since 2022-12-09
 */
@EqualsAndHashCode(callSuper = true)
@TableName("t_msg")
@Data
public class Msg extends Model<Msg> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 发送人
     */
    private String senderId;
    private Integer type;
    /**
     * 接收人
     */
    private String receiverId;
    private String msg;
    /**
     * 消息类型
     */
    private String msgId;
    @DateTimeFormat
    private Date time;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "Msg{" +
        ", id=" + id +
        ", senderId=" + senderId +
        ", receiverId=" + receiverId +
        ", msg=" + msg +
        ", msgId=" + msgId +
        "}";
    }
}
